﻿using IncidentesBL;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Messaging;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace IncidentesWCF
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "TB_PlanAccionCF" in both code and config file together.
    public class TB_PlanAccionCF : ITB_PlanAccionCF
    {

        TB_PlanAccionBL _TB_PlanAccionBL = new TB_PlanAccionBL();

        public bool CerrarTB_PlanAccion(short _PlanAccion_id)
        {
            return _TB_PlanAccionBL.CerrarTB_PlanAccion(_PlanAccion_id);
        }

        static void Main(string[] args)
        {
            //Crear la cola privada
            Console.ForegroundColor = ConsoleColor.Yellow;
            string nombrecola = ConfigurationManager.AppSettings["ColaIncidentes"];

            if (!MessageQueue.Exists(nombrecola))
            {
                MessageQueue.Create(nombrecola, true);
            }
            using (ServiceHost serviceHost = new ServiceHost(typeof(TB_PlanAccionCF)))
            {
                serviceHost.Open();
                Console.WriteLine("Servicio Listo");
                Console.ReadLine();
            }

        }
    }
}
